<template>
  <view class="">
    <view class="status_bar">
      <view class="top_view">
        <!-- #ifdef (H5 || APP-PLUS) -->
        <!-- <view :class="[' flex between plr20 alcenter plr20 bgWhite fixed w100 pos_l0b0',{'bgPart':theme == 'dark'}]"
						style="height: 80px;">
						<button class="goTranbuy bgGreen flex1 ptb1 mr20 white radius4"
							@click="goback">买入</button>
						<button class="goTransell bgRed flex1 ptb1 white radius4"
							@click="goback">卖出</button>
					</view> -->
        <!-- #endif -->
      </view>
    </view>
    <web-view :src="url"></web-view>
  </view>
</template>
<script>
import { myMixins } from '@/common/myMixins.js';
export default {
  mixins: [myMixins],
  data() {
    return {
      url: '',
      theme: '',
      type: '',
      option: ''
    };
  },
  methods: {
    // goback() {
    //   console.log('**********type***********', this.type);
    //   if (this.option == 'option') {
    //     uni.navigateBack({
    //       delta: 1
    //     });
    //   } else if (this.type == 0) {
    //     uni.switchTab({
    //       url: '/pages/trade/trade'
    //     });
    //   } else if (this.type == 1) {
    //     uni.switchTab({
    //       url: '/pages/lever/lever'
    //     });
    //   } else {
    //     uni.navigateBack({
    //       delta: 1
    //     });
    //   }

    // }
  },
  onLoad(e) {
    var theme = 'dark';
	console.log('eeeeeee:',e);
    // #ifdef H5
    console.log('H5');
    theme = localStorage.getItem('theme') || 'dark';
    //#endif

    // #ifdef APP
    console.log('APP', this.theme == 'dark');
    theme = plus.storage.getItem('theme') || 'dark';
    //#endif
    this.theme = theme;
    setTimeout(() => {
      uni.setNavigationBarTitle({
        title: e.symbol
      });
      if (this.theme == 'dark') {
        uni.setNavigationBarColor({
          frontColor: '#ffffff',
          backgroundColor: '#162633'
        });
      }
    }, 100);
    this.type = e.type;
    this.option = e.option;
	console.log(223456,this.option)
    var lang = 'zh';
    //this.url=`/hybrid/html/local.html?type=${e.type}&symbol=${e.symbol}`
    //#ifdef APP-PLUS
    lang = plus.storage.getItem('lang');
    //#endif
    // #ifdef H5
    lang = localStorage.getItem('lang') || 'zh';

    // #endif
    this.url =
      `/hybrid/html/index.html?type=${e.type}&symbol=${e.symbol}&option=${e.option}&theme=` +
      theme +
      '&lang=' +
      lang;

    // #ifdef APP-PLUS
    var wv = plus.webview.create('', 'custom-webview', {
      'plusrequire': 'none', //禁止远程网页使用plus的API，有些使用mui制作的网页可能会监听plus.key，造成关闭页面混乱，可以通过这种方式禁止
      'uni-app': 'none', //不加载uni-app渲染层框架，避免样式冲突
      'top': uni.getSystemInfoSync().statusBarHeight + 44 //放置在titleNView下方。如果还想在webview上方加个地址栏的什么的，可以继续降低TOP值
    });
    wv.setStyle({ height: uni.getSystemInfoSync().windowHeight });
    wv.loadURL(this.url);
    var currentWebview = this.$mp.page.$getAppWebview(); //获取当前页面的webview对象
    currentWebview.append(wv); //一定要append到当前的页面里！！！才能跟随当前页面一起做动画，一起关闭
    wv.getStyle();
    // setTimeout(function() {
    // 	console.log(wv.getStyle())
    // }, 2000);//如果是首页的onload调用时需要延时一下，二级页面无需延时，可直接获取
    // #endif
  }
};
</script>

<style></style>
